﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace SharpWeb
{
    /// <summary>
    /// 应用程序上下文
    /// </summary>
    public class SharpApplicationContext
    {
        private static SharpApplicationContext _Current;

        public static SharpApplicationContext Current
        {
            get { return _Current; }
        }
        
        private string _BasePath;
        /// <summary>
        /// 当前应用程序所在的物理路径
        /// </summary>
        public string BasePath
        {
            get { return _BasePath; }
        }

        private DateTime _StartTime;
        /// <summary>
        /// 启动时间
        /// </summary>
        public DateTime StartTime
        {
            get { return _StartTime; }
        }


        internal static void Init()
        {
            _Current = new SharpApplicationContext();
            _Current._BasePath = HttpContext.Current.Server.MapPath("/");
            _Current._StartTime = DateTime.Now;
        }
    }
}
